package com.chester.quickstarter.controller;

import com.alibaba.fastjson.JSONObject;
import com.chester.quickstarter.dao.domain.User;
import com.chester.quickstarter.dao.mapper.UserMapper;
import com.chester.quickstarter.service.UserService;
import com.chester.quickstarter.util.common.JsonResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author chester7cheng
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserMapper userMapper;
    @Autowired
    private UserService userService;

    @RequestMapping("/all")
    public JSONObject all(){
        List<User> userList = userService.findAll();
        return JsonResultUtil.generateSuccessJson(userList);
    }
}
